﻿using System;


namespace Coding4Fun.Cannon.TechEdPhone.Complete
{
	public enum TurningAction
    {
        Left,
        Right,
        None
    }
    
    public static class CannonUtility
    {
        //If your angle is >= this value, you're turning
		const double TurningThreshold = 45;
        const double TiltingThreshold = 45;

        public static double GetExactAngle(double value)
        {
            return value * -90;
        }


    	public static TurningAction GetTurn(double yAxis)
        {
            var angle = GetExactAngle(yAxis);

            if (Math.Abs(angle) <= 45)
            {
                return TurningAction.None;
            }
            else if (angle < 0)
            {
                //right turn
                return TurningAction.Right;
            }
            else 
            {
                return TurningAction.Left; 
            }

        }

    }
}
